package c.e.a.b.e.c;

import c.e.a.b.e.c.e4.b;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Objects;

/* compiled from: com.google.android.gms:play-services-measurement-base@@18.0.0 */
public class z3 extends t3 {
    public final byte[] d;

    public z3(byte[] bArr) {
        Objects.requireNonNull(bArr);
        this.d = bArr;
    }

    public byte b(int i) {
        return this.d[i];
    }

    public int c() {
        return this.d.length;
    }

    public final int d(int i, int i2, int i3) {
        byte[] bArr = this.d;
        int l = l();
        Charset charset = w4.a;
        for (int i4 = l; i4 < l + i3; i4++) {
            i = (i * 31) + bArr[i4];
        }
        return i;
    }

    public final t3 e(int i, int i2) {
        i = t3.j(0, i2, c());
        if (i == 0) {
            return t3.b;
        }
        return new y3(this.d, l(), i);
    }

    public final boolean equals(Object obj) {
        boolean z = true;
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof t3) || c() != ((t3) obj).c()) {
            return false;
        }
        if (c() == 0) {
            return true;
        }
        if (!(obj instanceof z3)) {
            return obj.equals(this);
        }
        z3 z3Var = (z3) obj;
        int i = this.a;
        int i2 = z3Var.a;
        if (i != 0 && i2 != 0 && i != i2) {
            return false;
        }
        i = c();
        StringBuilder stringBuilder;
        int l;
        if (i > z3Var.c()) {
            int c = c();
            stringBuilder = new StringBuilder(40);
            stringBuilder.append("Length too large: ");
            stringBuilder.append(i);
            stringBuilder.append(c);
            throw new IllegalArgumentException(stringBuilder.toString());
        } else if (i <= z3Var.c()) {
            byte[] bArr = this.d;
            byte[] bArr2 = z3Var.d;
            int l2 = l() + i;
            i = l();
            l = z3Var.l();
            while (i < l2) {
                if (bArr[i] != bArr2[l]) {
                    z = false;
                    break;
                }
                i++;
                l++;
            }
            return z;
        } else {
            l = z3Var.c();
            stringBuilder = new StringBuilder(59);
            stringBuilder.append("Ran off end of other: 0, ");
            stringBuilder.append(i);
            stringBuilder.append(", ");
            stringBuilder.append(l);
            throw new IllegalArgumentException(stringBuilder.toString());
        }
    }

    public final String g(Charset charset) {
        return new String(this.d, l(), c(), charset);
    }

    public final void h(u3 u3Var) throws IOException {
        ((b) u3Var).Z(this.d, l(), c());
    }

    public byte i(int i) {
        return this.d[i];
    }

    public final boolean k() {
        int l = l();
        return m7.b(this.d, l, c() + l);
    }

    public int l() {
        return 0;
    }
}
